package cn.tedu.springbootdemo.bean;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component;

@Component
/**
 * @ConditionalOnBean(Worker.class) 表示在Spring中
 * 有Worker.class类型的Bean的时候就创建Saw对象，否则不创建
 */
@ConditionalOnBean(Worker.class)
public class Saw implements Tool {
    @Override
    public String toString() {
        return "电锯";
    }
}
